package com.atguigu.paymentdemo.config;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;

@Component
@Slf4j
@Data
@PropertySource("classpath:redis.properties") //读取配置文件
@ConfigurationProperties(prefix="redis") //读取wxpay节点
public class RedisConfig {
    String host ;
    int port;
    String maxTotal;
    String maxIdle;

    @Bean
    public Jedis getJedis(){
        log.info("生成Jedis连接对象");
        return new Jedis(host,port);
    }
}
